package gemini.pollux.ui.server.service.impl;

import gemini.basic.manager.ProductManager;
import gemini.basic.model.Product;
import gemini.pollux.ui.client.service.ProductService;
import gemini.pollux.ui.server.service.AbstractSingleService;

import java.util.ArrayList;

public class ProductServiceImpl extends
        AbstractSingleService<ProductManager> implements
        ProductService {

	@Override
	public ArrayList<Product> getAllProducts() {
		ArrayList<Product> result = duplicate(getServerManager().getAllProducts());
    	return result;
	}

	@Override
	public void deleteProduct(Integer id) {
		getServerManager().deleteProduct(id);
	}

	@Override
	public Product saveOrUpdateProduct(Product productType) {
		Product result = duplicateExcludeFields(getServerManager().saveOrUpdateProduct(productType));
    	return result;
	}
}
